import { createSSRApp } from 'vue'
import { install as installCore } from '@ibiz-template/core'
import { install as installRuntime } from '@ibiz-template/runtime'
import App from './App.vue'
import store from './store'
import { routeInterceptor, requestInterceptor, prototypeInterceptor } from './interceptors'
import { IBizViewEngine } from './view-engine'
import { i18n, iBizI18n } from './locale'
import Components from './components'
import 'virtual:uno.css'
import '@/style/index.scss'

export function createApp() {
  const app = createSSRApp(App)
  app.use(store)
  app.use(i18n)
  app.use(routeInterceptor)
  app.use(requestInterceptor)
  app.use(prototypeInterceptor)
  installCore()
  installRuntime()
  Object.assign(ibiz.env, {
    appId: 'demosys__mobvue3',
    dcSystem: 'demosys',
    isMob: true,
  })
  app.use(IBizViewEngine)
  ibiz.i18n = iBizI18n
  ibiz.i18n.init()
  app.use(Components)
  return {
    app,
  }
}
